/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package factory;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author wida46984148
 */
public class NauWida1 extends NauBase {
    int puntuancion;
    int vides;  //vidas nabe se aprobexa como contador si eso
    int muertes;    //contador muertes

    public NauWida1(float vida, float vidaT,int vides, MoveShoot shoot, Image nau, Image nauDestroy){
        super(vida, vidaT, shoot, nau, nauDestroy);
        this.vides = vides;
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sb, int delta) {
    }

    @Override
    public void render(GameContainer gc, Graphics g){
        if(!(super.isMort() && vides==1)){
            if(!(super.isMort())){
                g.drawImage(nau, posX, posY);
            }else{
                g.drawImage(nauDestroy, posX, posY);
                vides--;
                super.destroy = false;
                vida = vidaT;
                posX=350;
                posY=800;
                g.drawImage(nau, posX, posY);
                muertes++;
            }
        }else {
            muertes++;
            super.destroy = true;
        }
//        renderVida(gc, g);
//        renderVides(gc, g);
    }

    public void renderVida(GameContainer gc, Graphics g) {
        if (vida > 0) {
            g.setColor(Color.red);
            g.fillRect(30, 10, (vida / vidaT) * 200, 15);
        }
        g.setColor(Color.white);
        g.drawRect(30, 10, 200, 15);
    }

    public void renderVides(GameContainer gc, Graphics g) {
        for (int i = 0; i < vides; i++) {
            g.setColor(Color.white);
            g.fillRect(500+i*25, 10, 20, 20);

            //g.drawImage(new Image("src/data/w00t.git"), 500+i*25, 20, Color.red);
        }
    }

    public Shoot getProjectil() {
        return shoot.cloneShoot();
    }

    public int getPuntuancion() {
        return puntuancion;
    }

    public void setPuntuancion(int puntuancion) {
        this.puntuancion += puntuancion;
    }

    
}
